int searchInsert(int* a, int sz, int target) {
    //使用二分查找
    int i = 0, j = sz - 1;
    while(j >= i){
        int mid = (j + i) / 2;
        if(target < a[mid]){
            j = mid - 1;
        }
        else if(target >a[mid]){
            i =  mid + 1;
        }
        else{
            return mid;
        }
    }
    return i;
}